<?php

chdir("..");
ini_set( "display_errors", true );

require_once("PhpFaces.php");

PhpFaces::SetupEnvironment( "faces-config.xml" );

$facesContext = PhpFaces_FacesContext::getCurrentInstance();

$newsItems = $facesContext->resolve("#{newsBean.recentNewsItems}");


header( "Content-type: text/xml" );
?>
<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PhpFaces news</title>
    <link>http://rosehill.homedns.org:81/phpfaces/</link>
    <description>Latest updates about the PhpFaces project.</description>
    <language>en-us</language>
    <pubDate><?php echo date("r") ?></pubDate>
    <lastBuildDate><?php echo date("r") ?></lastBuildDate>
    <generator>PhpFaces Ghetto rss.php</generator>
    <managingEditor>h dot iverson at gmail dot com</managingEditor>
    <webMaster>h dot iverson at gmail dot com</webMaster>

	<?php foreach( $newsItems as $item ) { ?>
    <item>
      <title><?php echo htmlentities($item->title); ?></title>
      <link>http://rosehill.homedns.org:81/phpfaces/#yeajusthehomepagefool</link>
      <description><?php echo htmlentities($item->body); ?></description>
      <pubDate><?php echo date("r", $item->time ); ?></pubDate>
      <guid>urn:phpfaces-news#<?php echo $item->newsId; ?></guid>
    </item>
    <?php } ?>
  </channel>
</rss>